<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('index')}">员工列表</a></li>
			<li class="active"><a href="{:url('add')}">添加员工</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('add')}">
			<!--<div class="form-group">-->
				<!--<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>账号</label>-->
				<!--<div class="col-md-6 col-sm-10">-->
					<!--<input type="text" class="form-control" required id="input-user_login" name="user_login">-->
				<!--</div>-->
			<!--</div>-->
			<div class="form-group">
				<label for="input-user_email" class="col-sm-2 control-label"><span class="form-required">*</span>邮箱</label>
				<div class="col-md-6 col-sm-10">
					<input type="email" class="form-control" id="input-user_email" name="user_email" required>
				</div>
			</div>
			<div class="form-group">
				<label for="input-user_pass" class="col-sm-2 control-label"><span class="form-required">*</span>密码</label>
				<div class="col-md-6 col-sm-10">
					<input type="password" class="form-control" value="xkf2017" required id="input-user_pass" name="user_pass" placeholder="password">
				</div>
			</div>
			<div class="form-group">
				<label for="input-user_nickname" class="col-sm-2 control-label"><span class="form-required">*</span>姓名</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" required id="input-user_nickname" name="user_nickname">
				</div>
			</div>
			<div class="form-group">
				<label for="input-dep_id" class="col-sm-2 control-label"><span class="form-required">*</span>所属部门</label>
				<div class="col-md-6 col-sm-10">
					<input class="form-control" type="text" style="width:400px;" required value="{$default.name|default=''}"
						   placeholder="请选择部门" onclick="doSelectLayer(this);"
						   data-url="{:url('department/select')}" data-id="input-dep_id" name="layer_temp[]" data-son_id="input-role_id"
						   readonly/>
					<input class="form-control" type="hidden" value="" name="dep_id"
						   id="input-dep_id"/>
				</div>
			</div>
			<div class="form-group">
				<label for="input-role_id" class="col-sm-2 control-label"><span class="form-required">*</span>职位</label>
				<div class="col-md-6 col-sm-10">
					<input class="form-control" type="text" style="width:400px;" required value="{$default.name|default=''}"
						   placeholder="请选择职位" onclick="doSelectLayer(this);"
						   data-url="{:url('position/select')}" data-id="input-role_id" name="layer_temp[1]" data-parent_id="input-dep_id"
						   readonly/>
					<input class="form-control" type="hidden" value="" name="role_id"
						   id="input-role_id"/>
				</div>
			</div>
			<div class="form-group">
				<label for="input-mobile" class="col-sm-2 control-label">联系电话</label>
				<div class="col-md-6 col-sm-10">
					<input type="tel" class="form-control" id="input-mobile" name="mobile">
				</div>
			</div>
			<div class="form-group">
				<label for="input-fr_reset_pass" class="col-sm-2 control-label"></label>
				<div class="col-md-6 col-sm-10">
					<input type="checkbox" id="input-fr_reset_pass" name="fr_reset_pass" checked> 初次登陆强制修改密码
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
					<a class="btn btn-default" href="javascript:history.back(-1);">返回</a>
				</div>
			</div>
		</form>
	</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
	function doSelectCategory() {
		var selectedCategoriesId = $('#input-parent_id').val();
		openIframeLayer("{:url('AdminDepartment/select')}?id=" + selectedCategoriesId, '请选择分类', {
			area: ['700px', '400px'],
			btn: ['确定', '取消'],
			yes: function (index, layero) {
				//do something
				var iframeWin          = window[layero.find('iframe')[0]['name']];
				var selectedCategories = iframeWin.confirm();
				if (selectedCategories.selectedCategoriesId.length == 0) {
					layer.msg('请选择分类');
					return;
				}
				$('#input-parent_id').val(selectedCategories.selectedCategoriesId.join(','));
				$('#input-parent_id-name').val(selectedCategories.selectedCategoriesName.join(' '));
				//console.log(layer.getFrameIndex(index));
				layer.close(index); //如果设定了yes回调，需进行手工关闭
			}
		});
	}
</script>
</body>
</html>